
//
//  BFVideoPlayer.m
//  beifang
//
//  Created by Apple on 17/4/25.
//  Copyright © 2017年 郭凯. All rights reserved.
//

#import "BFVideoPlayer.h"
#import <AVFoundation/AVFoundation.h>
@interface BFVideoPlayer()
@property(nonatomic,strong)AVPlayer *player;
@property (nonatomic,strong) AVPlayerLayer* playerLayer;
@end

@implementation BFVideoPlayer
/**播放视频文件*/
-(void)playVideo:(NSURL *)url targetView:(UIView *)targetView{
    self.player = [[AVPlayer alloc]initWithURL:url];
    AVPlayerLayer *playLayer = [AVPlayerLayer playerLayerWithPlayer:self.player];
    self.playerLayer = playLayer;
    playLayer.frame = targetView.bounds;
    [targetView.layer addSublayer:self.playerLayer];
    [self.player play];
}
/**暂停音视频文件播放*/
-(void)pasue{
    [self.player pause];
}
/**恢复播放*/
-(void)resume{
    [self.player play];
}
/**结束*/
-(void)stop{

}
@end
